# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: spider-mario <spidermario@free.fr>
# Contributor: Olaf Leidinger <oleid@mescharet.de>
# Contributor: fabien Cellier <fabien.cellier@gmail.com>

pkgname=pocl
pkgver=4.0
pkgrel=2
pkgdesc="Portable OpenCL is an open-source implementation of OpenCL which can be easily adapted for new targets"
arch=('loong64' 'x86_64')
url="http://portablecl.org/"
license=('GPL')
source=("$pkgname-$pkgver.tar.gz::https://github.com/$pkgname/$pkgname/archive/v$pkgver.tar.gz")
depends=('clang' 'hwloc' 'opencl-icd-loader')
makedepends=('llvm' 'cmake' 'opencl-headers' 'ocl-icd' 'ninja' 'python')
sha512sums=('3835a9e8fc8562d50a91a11b807cf87a096891f5c27675127b66412eacff2e541b6143b49b4155f43a09f4e53faa062ec20f3b20badeca206ece9f45ad50f26a')

build() {
  cd "$pkgname-$pkgver"
  cmake \
      -GNinja \
      -Bbuild \
      -DCMAKE_INSTALL_PREFIX=/usr \
      -DCMAKE_INSTALL_LIBDIR=lib \
      -DCMAKE_BUILD_TYPE=Release \
      -DKERNELLIB_HOST_CPU_VARIANTS=distro
  ninja -C build
}

check() {
  cd "$pkgname-$pkgver"
  ninja -C build check
}

package() {
  cd "$pkgname-$pkgver"
  DESTDIR="$pkgdir"/ ninja -C build install
}
